<?php
/**
 * Created by PhpStorm.
 * User: s.utkin
 * Date: 04.09.14
 * Time: 16:58
 */

namespace Messenger\Users;


use Users\Profile;
use Messenger\BaseAction;

class ItemAction extends BaseAction {
	protected static $isPublic = true;
	
	/**
	 * Выводит плашку пользователя (для списка пользователей)
	 */
	protected function run()
	{
		$myProfileId = $this->request->myProfileId;
		$itemProfileId = $this->request->itemProfileId;
		$groupId = $this->request->groupId;
		$companionProfileId = $this->request->companionProfileId;

		$itemProfile = Profile::find($itemProfileId);

		if ($itemProfile == null) {
			throw new \Exception('Профиль "' . $itemProfileId . '" не найден', 404);
		}

		$this->response->itemProfile = $itemProfile;
		$this->response->companionProfileId = $companionProfileId;
		$this->response->myProfileId = $myProfileId;
		$this->response->groupId = $groupId;
	}
}